Skip to content

Build a shared library for use with each test #294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 59 commits into from
Oct 17, 2021

Conversation

jgfoster
Copy link
Member

@jgfoster jgfoster commented Mar 24, 2021

Instead of recompiling all the source files for each test, we now build a single shared library with everything except the test and then compile the test and link to the shared library. When I test SampleProjects/TestSomething the time reduces from 2:25 to 0:48. On our TankControllerLib, this reduces the test time from 38:16 to 2:06, so a massive win!

I realize that I'm getting pretty deep into the internals, but it looks like I have it passing on Linux, macOS, and Windows.

Fix #227.

@jgfoster
Copy link
Member Author

With Open-Acidification/TankController#207 our tests went from 42:30 to 2:30! (Unfortunately, we've had to start using a fork of arduino_ci in order to have this work.)

@ianfixes
Copy link
Collaborator

ianfixes commented Oct 4, 2021

I like what's going on here but I'd feel more comfortable if we found a way to factor this a bit better. For example:

  • a constant (or function) instead of a duplicated string to provide the name of the shared library
  • a function to calculate the path of the shared library
  • a standalone function responsible for building the library
  • a standalone function to check whether the shared library exists (if necessary)

I can probably take a crack at this if you'd like

@jgfoster
Copy link
Member Author

jgfoster commented Oct 4, 2021

As mentioned a moment ago in another PR, this is the remaining PR that I haven't merged and that is because I'm a bit hesitant, partly for the reasons you suggest (and partly because it doesn't give the speed improvements I anticipated). As long as this is unmerged, our TankController project will continue to use a fork (which is fine; we've been doing it for some months).

So, yes, if you see what I'm trying to do and can find a way to factor it better, that would be wonderful. But, please don't feel an obligation to take my problems and try to solve them!

@jgfoster jgfoster merged commit d72c378 into Arduino-CI:master Oct 17, 2021
@jgfoster jgfoster deleted the shared_library branch October 17, 2021 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compile arduino_ci once as a linkable library and use for each test
2 participants